home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.3
/
Video Toaster v4.3.iso
/
3.1
/
toasterall
/
arexx_examples
/
lwm
/
calculate.lwm
< prev
next >
Wrap
Text File
|
1993-06-08
|
950b
|
42 lines
/* CMD: Calculate
* Handy Calculator thing! */
/* By Arnie Cachelin, Copyright © 1992, 1993 NewTek Inc. */
/* Thu Feb 4 14:36:06 1993 */
libadd = addlib("LWModelerARexx.port",0)
Continue=1
signal on error
signal on syntax
MATHLIB="rexxmathlib.library"
IF POS(MATHLIB , SHOW('L')) = 0 THEN
IF ~ADDLIB(MATHLIB , 0 , -30 , 0) THEN DO
call notify(1,"!Can't find "MATHLIB)
exit
END
call req_begin "Calculate"
TxId = req_addcontrol("",'T',"Enter An Expression To Evaluate")
EqId = req_addcontrol("",'S',40)
call req_setval EqId,'12.2*sin(45)/6', '1+1'
do while Continue
x = req_post()
if (x) then do
RHS= req_getval(EqId)
end
else do
call req_end()
exit
end
interpret 'Val='RHS
continue = notify(2, '!Calculated',RHS'='Val*1,'@Calculate Another?')
end
call req_end()
exit
syntax:
error:
t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
if libadd then call remlib("LWModelerARexx.port")
exit